/**
 * \file XMLTextNode.cpp
 * \brief XMLTextNode definition class
 * \author Edouard ROGE
 * \date 16 October 2012
 */

#include "XMLTextNode.h"

namespace Core
{
	namespace File
	{
		XMLTextNode::XMLTextNode()
		{

		}

		XMLTextNode::~XMLTextNode()
		{

		}

		void XMLTextNode::SetText(const std::string & _strText)
		{
			m_strText = _strText;
		}

		const std::string & XMLTextNode::GetText() const
		{
			return m_strText;
		}

		error XMLTextNode::Save(File & _file, uint32 _iDepth) const
		{
			//indentation
			for (uint32 i = 0; i < _iDepth; ++i)
				_file << "\t";

			// name
			_file << "<" << GetName() << ">\n";

			for (uint32 i = 0; i < m_Children.size(); ++i)
				m_Children[i]->Save(_file, _iDepth + 1);

			// end balise
			_file << "</" << GetName() << ">\n";

			return errOK;
		}
	}
}